package appconfig

import (
	"fmt"
	"github.com/spf13/viper"
)

type Config struct {
	Nacos struct {
		NamespaceId string
		Host        string
		DataId      string
		Group       string
	}
}

var AppConfig Config

func Init() {
	viper.SetConfigFile("../../appconfig/dev.yaml")
	err := viper.ReadInConfig()
	if err != nil {
		fmt.Println("viper 读取失败")
	}
	err = viper.Unmarshal(&AppConfig)
	if err != nil {
		fmt.Println("viper 解析失败")
	}
	fmt.Println("viper success")
}
